home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_vim.idb / usr / freeware / share / vim / syntax / cobol.vim.z / cobol.vim
Encoding:
Text File  |  1998-10-28  |  2.9 KB  |  82 lines

  1. " Vim syntax file
  2. " Language: COBOL
  3. " Maintainer:   Sitaram Chamarty <sitaram@diac.com>
  4. " Last change:  1998 January 29
  5. " For a fully commented version please see http://www.diac.com/~sitaram/vim
  6.  
  7. " MOST important - else most of the keywords wont work!
  8. set isk=@,48-57,-
  9. " ...the usual :-)
  10. syn clear
  11. " COBOL syntax is case insensitive
  12. syn case ignore
  13.  
  14. syn match   cobolTodo         "todo" contained    " can appear in comments only
  15. " many legacy sources have junk in columns 1-6
  16. syn match   cobolJunk         "^......"           " must be before cobolComment
  17. syn match   cobolComment      "^......\*.*"hs=s+6 contains=cobolTodo
  18.  
  19. syn keyword cobolGoTo         GO GOTO
  20. syn keyword cobolCopy         COPY
  21. syn keyword cobolBAD          ALTER ENTER RENAMES
  22.  
  23. syn keyword cobolCondFlow     ELSE    " IF INVALID END interfere with the region
  24.  
  25. " the next should really be a list of keywords like END-IF END-READ, etc...
  26. " someday... :-) (TODO)
  27. syn match   cobolCondFlow     "\<END-[A-Z]\+\>"
  28. " cobolWatch: things that are important when trying to understand a program
  29. syn keyword cobolWatch        OCCURS DEPENDING VARYING BINARY COMP REDEFINES
  30. syn keyword cobolWatch        REPLACING RUN
  31. syn match   cobolWatch        "COMP-[123456XN]"
  32. syn keyword cobolEXECs        EXEC END-EXEC
  33.  
  34. syn match   cobolParas        "^...... \{1,4}[A-Z0-9][^"]\{-}\."hs=s+7
  35. syn match   cobolDecl         "^...... \{1,4}[0-9]\+ "
  36.  
  37. syn keyword cobolStmts        ACCEPT ADD CLOSE COMPUTE CONTINUE DELETE DISPLAY
  38. syn keyword cobolStmts        DIVIDE EVALUATE EXIT INSPECT MERGE MOVE MULTIPLY
  39. syn keyword cobolStmts        OPEN READ REWIND REWRITE SEARCH SELECT SET SORT
  40. syn keyword cobolStmts        START STOP STRING SUBTRACT WRITE
  41. " TODO: add more.  Eventually, add all "standard" ones.
  42.  
  43. syn keyword cobolExtras       PERFORM
  44. syn keyword cobolExtras       CALL CANCEL CORR CORRESPONDING GOBACK
  45. syn match   cobolExtras       "EXIT \+PROGRAM"
  46. syn match   cobolExtras       /\<VALUE \+[0-9]\+\./hs=s+6,he=e-1
  47.  
  48. syn match   cobolString       /".\{-}"/
  49. syn match   cobolString       /'.\{-}'/
  50.  
  51. " All REGIONS come last...
  52.  
  53. syn region  cobolCondFlow     contains=ALL start="\<\(IF\|INVALID\|END\|EOP\)\>" skip=/"[^"]\+"/ end="\."
  54.  
  55. if !exists("did_cobol_syntax_inits")
  56.   let did_cobol_syntax_inits = 1
  57.   " syntax groups to "levels"
  58.   hi link cobolGoTo     cobolSevere
  59.   hi link cobolCopy     cobolSevere
  60.   hi link cobolBAD      cobolSevere
  61.  
  62.   hi link cobolCondFlow cobolWatchpts
  63.   hi link cobolWatch    cobolWatchpts
  64.   hi link cobolEXECs    cobolWatchpts
  65.  
  66.   hi link cobolParas    cobolMarginA
  67.  
  68.   " cobol* highlights -> "standard" (syntax.vim) highlight groups
  69.   hi link cobolComment  Comment
  70.   hi link cobolSevere   Error
  71.   hi link cobolTodo     Todo
  72.   hi link cobolWatchpts Special
  73.   hi link cobolMarginA  Constant
  74.   hi link cobolStmts    Statement
  75.   hi link cobolExtras   Special
  76.   hi link cobolString   Constant
  77. endif
  78.  
  79. let b:current_syntax = "cobol"
  80.  
  81. " vim: ts=8
  82.